$(function () {
    var systemLog_datagrid = $("#systemLog_datagrid");

    var methodObj = {
        //加载按钮
        reload: function () {
            if (systemLog_datagrid.prop('value')){
                systemLog_datagrid.datagrid("reload");
            }
            systemLog_datagrid.datagrid({
                fitColumns: true,
                fit: true,
                toolbar: '#systemLog_toolbar',
                url: '/systemLog/list.do',
                pagination: true,
                striped: true,
                rownumbers: true,
                singleSelect: true,
                columns: [[
                    {title: '编号', field: 'id', width: '100'},
                    {title: '操作人', field: 'opUser_Name', width: '100',formatter: function (value, row, index){
                            return row.opUser ? row.opUser.username:"";
                        }
                    },
                    {title: '操作时间', field: 'opTime', width: '100'},
                    {title: '操作主机IP', field: 'opIp', width: '100'},
                    {title: '操作方法', field: 'function', width: '100'},
                    {title: '方法参数', field: 'params', width: '100'}
                ]]
            })
        }
    }


    $("a[data-cmd]").click(function () {
        var cmd = $(this).data("cmd");
        methodObj[cmd]();
    })

})

